package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicWarehouseBatchInDAO;
import com.cssy.xxkj.logic.entity.LogicWarehouseBatchInDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2015-03-03
 */
public class LogicWarehouseBatchInDAOImpl extends SqlMapClientDaoSupport implements LogicWarehouseBatchInDAO {

    /**
     * 插入数据
     * @param logicWarehouseBatchInDO
     * @return 插入数据的主键
     */
    public String insertLogicWarehouseBatchInDO(LogicWarehouseBatchInDO logicWarehouseBatchInDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicWarehouseBatchIn.insert", logicWarehouseBatchInDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWarehouseBatchInDO
     * @return 查出的记录数
     */
    public Integer countLogicWarehouseBatchInDOByExample(LogicWarehouseBatchInDO logicWarehouseBatchInDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseBatchIn.countByDOExample", logicWarehouseBatchInDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWarehouseBatchInDO
     * @return 受影响的行数
     */
    public Integer updateLogicWarehouseBatchInDO(LogicWarehouseBatchInDO logicWarehouseBatchInDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicWarehouseBatchIn.update", logicWarehouseBatchInDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWarehouseBatchInDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWarehouseBatchInDO> findListByExample(LogicWarehouseBatchInDO logicWarehouseBatchInDO) throws DataAccessException {
        List<LogicWarehouseBatchInDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseBatchIn.findListByDO", logicWarehouseBatchInDO);
        return list;
    }

    /**
     * 根据主键获取logicWarehouseBatchInDO
     * @param id
     * @return logicWarehouseBatchInDO
     */
    public LogicWarehouseBatchInDO findLogicWarehouseBatchInDOByPrimaryKey(String id) throws DataAccessException {
        LogicWarehouseBatchInDO logicWarehouseBatchInDO = (LogicWarehouseBatchInDO) getSqlMapClientTemplate().queryForObject("LogicWarehouseBatchIn.findByPrimaryKey", id);
        return logicWarehouseBatchInDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWarehouseBatchInDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehouseBatchIn.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicWarehouseBatchInDO> find(SearchConditions scs)
			throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("LogicWarehouseBatchIn_ex.find", scs);
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		return (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseBatchIn_ex.count", scs);
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		// TODO Auto-generated method stub
		return null;
	}

}